﻿// <copyright file="BloodAbilitiesExporter.cs" company="Gravity Age Studios">
// Code released under the MIT license (see License.txt).
// </copyright>
// <author>Vicente Cartas Espinel</author>
// <email>vicente.cartas@gmail.com</email>
namespace LightSwitchApplication.Export
{
    using System.IO;
    using Microsoft.LightSwitch.Framework.Client;

    public class BloodAbilityExporter : IExporter<BloodAbility>
    {
        public void WriteHeaders(StreamWriter stream)
        {
            stream.WriteLine("Visibility;Name;Derivation;Strength;Public Information;GM Information");
        }

        public void ExportData(StreamWriter stream, VisualCollection<BloodAbility> collection)
        {
            foreach (var bloodAbility in collection)
            {
                stream.WriteLine(string.Format("{0};{1};{2};{3};{4};{5}",
                    bloodAbility.Visibility,
                    bloodAbility.Name != null ? bloodAbility.Name.Replace(";", ".") : string.Empty,
                    bloodAbility.BloodlineDerivation != null ? bloodAbility.BloodlineDerivation.Name.Replace(";", ".") : string.Empty,
                    bloodAbility.BloodlineStrength != null ? bloodAbility.BloodlineStrength.Name.Replace(";", ".") : string.Empty,
                    bloodAbility.PublicInformation != null ? bloodAbility.PublicInformation.Replace(";", ".") : string.Empty,
                    bloodAbility.GMInformation != null ? bloodAbility.GMInformation.Replace(";", ".") : string.Empty));
            }
        }
    }
}
